/*
 * @Author: yanjikun
 * @Date: 2022-01-04 16:46:19
 * @LastEditors: yanjikun
 * @LastEditTime: 2022-06-02 10:46:35
 * @Description: file content
 */
import { Component } from 'vue'
import { ComponentType } from './types'
import {
  Cascader,
  DatePicker,
  Divider,
  Input,
  InputNumber,
  Radio,
  Select,
  Switch,
  TreeSelect,
  Upload,
} from 'ant-design-vue'
import ApiSelect from './components/ApiSelect.vue'
import ApiTreeSelect from './components/ApiTreeSelect.vue'
import IconsSelect from './components/IconsSelect.vue'
import AddressSelect from './components/AddressSelect.vue'
import BasicTinymce from '@/components/Tinymce'

const componentMap = new Map<ComponentType, Component>()
componentMap.set('Input', Input)
componentMap.set('InputNumber', InputNumber)
componentMap.set('InputTextArea', Input.TextArea)
componentMap.set('InputPassword', Input.Password)
componentMap.set('InputSearch', Input.Search)
componentMap.set('Divider', Divider)
componentMap.set('Select', Select)
componentMap.set('Cascader', Cascader)
componentMap.set('Switch', Switch)
componentMap.set('DatePicker', DatePicker)
componentMap.set('RangePicker', DatePicker.RangePicker)
componentMap.set('Upload', Upload)
componentMap.set('TreeSelect', TreeSelect)
componentMap.set('RadioGroup', Radio.Group)
componentMap.set('Radio', Radio)
componentMap.set('ApiSelect', ApiSelect)
componentMap.set('ApiTreeSelect', ApiTreeSelect)
componentMap.set('IconsSelect', IconsSelect)
componentMap.set('AddressSelect', AddressSelect)
componentMap.set('Tinymce', BasicTinymce)
export const add = (comName: ComponentType, component: Component) => {
  componentMap.set(comName, component)
}
export const del = (comName: ComponentType) => {
  componentMap.delete(comName)
}
export { componentMap }
